/*
 * Copyright (C) 2024-2025 Deepin Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef SCOREBAR_H
#define SCOREBAR_H

#include "devcommon_global.h"

#include <QColor>
#include <QSize>

#include <QWidget>

class DEVCOMMONSHARED_EXPORT ScoreBar : public QWidget
{
    Q_OBJECT
public:
    explicit ScoreBar(QWidget *parent = nullptr);
    ~ScoreBar();

protected:
    void paintEvent(QPaintEvent *);
    void drawCircle(QPainter *painter, int radius);
    void drawArc(QPainter *painter, int radius);
    void drawPolo(QPainter *painter, int radius);

private:
    int m_maxValue;                 //最大值
    int m_minValue;                 //最小值
    int m_value;

    int m_nullPosition;               //起始角度
    int m_lineWidth;                  //线条宽度

    bool m_showPercent;               //是否显示百分比
    bool m_showFree;                  //是否显示未使用进度
    bool m_showSmallCircle;           //是否显示小圆
    bool m_clockWise;                 //顺时针

    QColor m_usedColor;               //已使用百分比颜色
    QColor m_freeColor;               //未使用百分比颜色
    QColor m_circleColor;             //圆颜色

public:
    QSize sizeHint()                const;
    QSize minimumSizeHint()         const;

public Q_SLOTS:
    //设置目标值
    void setValue(int value);

    //设置已使用百分比颜色
    void setUsedColor(const QColor &usedColor);
    //设置未使用百分比颜色
    void setFreeColor(const QColor &freeColor);
    //设置圆颜色
    void setCircleColor(const QColor &circleColor);
};


#endif // SCOREBAR_H
